<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>AdWords API Documentation</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta><link rel="stylesheet" href="../css/template.css" type="text/css"></link></head><body><div id="content"><h1 class="file">Common/Util/SoapRequestXmlFixer.php</h1><div id="file-nav-box"><div id="file-nav-container"><ul id="file-nav"><li><a href="#classes"><img src="../images/icons/class.png" alt="Class" height="14"></img>
                          Classes
                      </a><ul><li><a href="#\SoapRequestXmlFixer">\SoapRequestXmlFixer</a></li></ul></li></ul><div style="clear: left;"></div></div><div id="file-nav-tab">
              Table of Contents
          </div></div><a name="top" class="anchor"></a><div id="file-description"><div class="short-description">The SOAP XML request fixer used to fix some inconsistencies among the
different versions of the PHP SoapClient.</div><div class="long-description"><p>PHP version 5</p>

<p>Copyright 2011, Google Inc. All Rights Reserved.</p>

<p>Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at</p>

<pre><code>http://www.apache.org/licenses/LICENSE-2.0
</code></pre>

<p>Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.</p></div></div><dl class="file-info"><dt>Author</dt><dd>Adam Rogal
         
    </dd><dt>Author</dt><dd>Eric Koleda
         
    </dd><dt>Author</dt><dd>Vincent Tsao
         
    </dd><dt>Category</dt><dd>WebServices
         
    </dd><dt>Copyright</dt><dd>2011, Google Inc. All Rights Reserved.
         
    </dd><dt>License</dt><dd>http://www.apache.org/licenses/LICENSE-2.0 Apache License,
            Version 2.0
         
    </dd><dt>Package</dt><dd>GoogleApiAdsCommon
         
    </dd><dt>Subpackage</dt><dd>Util
         
    </dd></dl><a name="classes" class="anchor"></a><a id="\SoapRequestXmlFixer" class="anchor"></a><h2 class="class">\SoapRequestXmlFixer<div class="to-top"><a href="#top">jump to top</a></div></h2><div class="class"><small class="package"><b>Package: </b>GoogleApiAdsCommon\Util</small><div class="short-description">The SOAP XML request fixer used to fix some inconsistencies among the
different versions of the PHP SoapClient.</div><div class="long-description"></div><dl class="class-info"></dl><h3>Properties</h3><div><a id="\SoapRequestXmlFixer::$XSI_NAMESPACE" class="anchor"></a><div class="property private"><a href="#" class="gripper"><img src="../images/icons/arrow_right.png" alt="&gt;"></img><img src="../images/icons/arrow_down.png" alt="V" style="display: none;"></img></a><code class="title"><img src="../images/icons/property.png" alt="Property"></img><img src="../images/icons/visibility_private.png" style="margin-right: 5px" alt="private"></img><span class="highlight">$XSI_NAMESPACE</span> = 'http://www.w3.org/2001/XMLSchema-instance'</code><div class="description"><span class="attribute">static</span></div><div class="code-tabs"><strong>Default value</strong><code>'http://www.w3.org/2001/XMLSchema-instance'</code><strong>Details</strong><dl class="property-info"><dt>Type</dt><dd>n/a</dd></dl></div><div class="clear"></div></div><a id="\SoapRequestXmlFixer::$addXsiTypes" class="anchor"></a><div class="property private"><a href="#" class="gripper"><img src="../images/icons/arrow_right.png" alt="&gt;"></img><img src="../images/icons/arrow_down.png" alt="V" style="display: none;"></img></a><code class="title"><img src="../images/icons/property.png" alt="Property"></img><img src="../images/icons/visibility_private.png" style="margin-right: 5px" alt="private"></img><span class="highlight">$addXsiTypes</span></code><div class="description"></div><div class="code-tabs"><strong>Details</strong><dl class="property-info"><dt>Type</dt><dd>n/a</dd></dl></div><div class="clear"></div></div><a id="\SoapRequestXmlFixer::$removeEmptyElements" class="anchor"></a><div class="property private"><a href="#" class="gripper"><img src="../images/icons/arrow_right.png" alt="&gt;"></img><img src="../images/icons/arrow_down.png" alt="V" style="display: none;"></img></a><code class="title"><img src="../images/icons/property.png" alt="Property"></img><img src="../images/icons/visibility_private.png" style="margin-right: 5px" alt="private"></img><span class="highlight">$removeEmptyElements</span></code><div class="description"></div><div class="code-tabs"><strong>Details</strong><dl class="property-info"><dt>Type</dt><dd>n/a</dd></dl></div><div class="clear"></div></div><a id="\SoapRequestXmlFixer::$replaceReferences" class="anchor"></a><div class="property private"><a href="#" class="gripper"><img src="../images/icons/arrow_right.png" alt="&gt;"></img><img src="../images/icons/arrow_down.png" alt="V" style="display: none;"></img></a><code class="title"><img src="../images/icons/property.png" alt="Property"></img><img src="../images/icons/visibility_private.png" style="margin-right: 5px" alt="private"></img><span class="highlight">$replaceReferences</span></code><div class="description"></div><div class="code-tabs"><strong>Details</strong><dl class="property-info"><dt>Type</dt><dd>n/a</dd></dl></div><div class="clear"></div></div></div><h3>Methods</h3><div><a id="\SoapRequestXmlFixer::AddXsiType()" class="anchor"></a><div class="method private"><a href="#" class="gripper"><img src="../images/icons/arrow_right.png"></img><img src="../images/icons/arrow_down.png" style="display: none;"></img></a><code class="title"><img src="../images/icons/method.png" alt="method" title="method"></img><img src="../images/icons/visibility_private.png" style="margin-right: 5px" alt="private"></img><span class="highlight">AddXsiType</span><span class="nb-faded-text">(<a href="../files/http://php.net/manual/en/class.domnode.php">\DOMNode</a> $domNode,  $object)</span> : void</code><div class="description"><p class="short_description">Adds the xsi:type to the DOMNode generated from the corresponding object.</p></div><div class="code-tabs"><div class="long-description"></div><strong>Parameters</strong><table class="argument-info"><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tr><th>$domNode</th><td><a href="../files/http://php.net/manual/en/class.domnode.php">\DOMNode</a></td><td><em><p>the DOM node corresponding to the object</p></em></td></tr><tr><th>$object</th><td></td><td><em><p>the object used to determine the xsi:type</p></em></td></tr></table><strong>Details</strong><dl class="function-info"><dt>Access</dt><dd>private
         
    </dd></dl></div><div class="clear"></div></div><a id="\SoapRequestXmlFixer::FixXml()" class="anchor"></a><div class="method public"><a href="#" class="gripper"><img src="../images/icons/arrow_right.png"></img><img src="../images/icons/arrow_down.png" style="display: none;"></img></a><code class="title"><img src="../images/icons/method.png" alt="method" title="method"></img><img src="../images/icons/visibility_public.png" style="margin-right: 5px" alt="public"></img><span class="highlight">FixXml</span><span class="nb-faded-text">(string $request, array $arguments, array $headers)</span> : string</code><div class="description"><p class="short_description">Fixes the XML based on the parameters specified in the constructor.</p></div><div class="code-tabs"><div class="long-description"></div><strong>Parameters</strong><table class="argument-info"><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tr><th>$request</th><td>string</td><td><em><p>the raw request produced by the SOAP client</p></em></td></tr><tr><th>$arguments</th><td>array</td><td><em><p>the arguments passed to the SOAP method</p></em></td></tr><tr><th>$headers</th><td>array</td><td><em><p>the headers used in the request</p></em></td></tr></table><strong>Returns</strong><table class="argument-info"><thead><tr><th>Type</th><th>Description</th></tr></thead><tr><td>string</td><td>the prepared request ready to be sent to the server</td></tr></table></div><div class="clear"></div></div><a id="\SoapRequestXmlFixer::FixXmlNode()" class="anchor"></a><div class="method private"><a href="#" class="gripper"><img src="../images/icons/arrow_right.png"></img><img src="../images/icons/arrow_down.png" style="display: none;"></img></a><code class="title"><img src="../images/icons/method.png" alt="method" title="method"></img><img src="../images/icons/visibility_private.png" style="margin-right: 5px" alt="private"></img><span class="highlight">FixXmlNode</span><span class="nb-faded-text">(<a href="../files/http://php.net/manual/en/class.domnode.php">\DOMNode</a> $node, mixed $object, <a href="../files/http://php.net/manual/en/class.domxpath.php">\DOMXPath</a> $xpath)</span> : void</code><div class="description"><p class="short_description">Fix a node corresponding to an objects.</p></div><div class="code-tabs"><div class="long-description"></div><strong>Parameters</strong><table class="argument-info"><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tr><th>$node</th><td><a href="../files/http://php.net/manual/en/class.domnode.php">\DOMNode</a></td><td><em><p>the node matching <var>$object</var></p>
</em></td></tr><tr><th>$object</th><td>mixed</td><td><em><p>the object matching <var>$node</var></p>
</em></td></tr><tr><th>$xpath</th><td><a href="../files/http://php.net/manual/en/class.domxpath.php">\DOMXPath</a></td><td><em><p>the xpath object representing the DOM</p></em></td></tr></table></div><div class="clear"></div></div><a id="\SoapRequestXmlFixer::FixXmlNodes()" class="anchor"></a><div class="method private"><a href="#" class="gripper"><img src="../images/icons/arrow_right.png"></img><img src="../images/icons/arrow_down.png" style="display: none;"></img></a><code class="title"><img src="../images/icons/method.png" alt="method" title="method"></img><img src="../images/icons/visibility_private.png" style="margin-right: 5px" alt="private"></img><span class="highlight">FixXmlNodes</span><span class="nb-faded-text">(<a href="../files/http://php.net/manual/en/class.domnodelist.php">\DOMNodeList</a> $nodeList, array $objects, <a href="../files/http://php.net/manual/en/class.domxpath.php">\DOMXPath</a> $xpath)</span> : void</code><div class="description"><p class="short_description">Fix a list of nodes corresponding to an array of objects.</p></div><div class="code-tabs"><div class="long-description"></div><strong>Parameters</strong><table class="argument-info"><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tr><th>$nodeList</th><td><a href="../files/http://php.net/manual/en/class.domnodelist.php">\DOMNodeList</a></td><td><em><p>the node list matching <var>$objects</var></p>
</em></td></tr><tr><th>$objects</th><td>array</td><td><em><p>the objects array matching <var>$nodeList</var></p>
</em></td></tr><tr><th>$xpath</th><td><a href="../files/http://php.net/manual/en/class.domxpath.php">\DOMXPath</a></td><td><em><p>the xpath object representing the DOM</p></em></td></tr></table></div><div class="clear"></div></div><a id="\SoapRequestXmlFixer::RemoveEmptyHeaderElements()" class="anchor"></a><div class="method private"><a href="#" class="gripper"><img src="../images/icons/arrow_right.png"></img><img src="../images/icons/arrow_down.png" style="display: none;"></img></a><code class="title"><img src="../images/icons/method.png" alt="method" title="method"></img><img src="../images/icons/visibility_private.png" style="margin-right: 5px" alt="private"></img><span class="highlight">RemoveEmptyHeaderElements</span><span class="nb-faded-text">(<a href="../files/http://php.net/manual/en/class.domxpath.php">\DOMXPath</a> $xpath)</span> : void</code><div class="description"><p class="short_description">Removes empty header elements from the request.</p></div><div class="code-tabs"><div class="long-description"></div><strong>Parameters</strong><table class="argument-info"><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tr><th>$xpath</th><td><a href="../files/http://php.net/manual/en/class.domxpath.php">\DOMXPath</a></td><td><em><p>the xpath object representing the DOM</p></em></td></tr></table><strong>Details</strong><dl class="function-info"><dt>Access</dt><dd>private
         
    </dd></dl></div><div class="clear"></div></div><a id="\SoapRequestXmlFixer::RemoveIdAttributes()" class="anchor"></a><div class="method private"><a href="#" class="gripper"><img src="../images/icons/arrow_right.png"></img><img src="../images/icons/arrow_down.png" style="display: none;"></img></a><code class="title"><img src="../images/icons/method.png" alt="method" title="method"></img><img src="../images/icons/visibility_private.png" style="margin-right: 5px" alt="private"></img><span class="highlight">RemoveIdAttributes</span><span class="nb-faded-text">(<a href="../files/http://php.net/manual/en/class.domxpath.php">\DOMXPath</a> $xpath)</span> : void</code><div class="description"><p class="short_description">Removed id attributes leftover after reference replacement.</p></div><div class="code-tabs"><div class="long-description"></div><strong>Parameters</strong><table class="argument-info"><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tr><th>$xpath</th><td><a href="../files/http://php.net/manual/en/class.domxpath.php">\DOMXPath</a></td><td><em><p>the xpath object representing the DOM</p></em></td></tr></table><strong>Details</strong><dl class="function-info"><dt>Access</dt><dd>private
         
    </dd></dl></div><div class="clear"></div></div><a id="\SoapRequestXmlFixer::ReplaceElementReference()" class="anchor"></a><div class="method private"><a href="#" class="gripper"><img src="../images/icons/arrow_right.png"></img><img src="../images/icons/arrow_down.png" style="display: none;"></img></a><code class="title"><img src="../images/icons/method.png" alt="method" title="method"></img><img src="../images/icons/visibility_private.png" style="margin-right: 5px" alt="private"></img><span class="highlight">ReplaceElementReference</span><span class="nb-faded-text">(<a href="../files/http://php.net/manual/en/class.domelement.php">\DOMElement</a> $elementReference, <a href="../files/http://php.net/manual/en/class.domxpath.php">\DOMXPath</a> $xpath)</span> : void</code><div class="description"><p class="short_description">Replaces an element reference with a copy of the element it references.</p></div><div class="code-tabs"><div class="long-description"></div><strong>Parameters</strong><table class="argument-info"><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tr><th>$elementReference</th><td><a href="../files/http://php.net/manual/en/class.domelement.php">\DOMElement</a></td><td><em><p>the element reference to replace</p></em></td></tr><tr><th>$xpath</th><td><a href="../files/http://php.net/manual/en/class.domxpath.php">\DOMXPath</a></td><td><em><p>the xpath object representing the DOM</p></em></td></tr></table><strong>Details</strong><dl class="function-info"><dt>Access</dt><dd>private
         
    </dd></dl></div><div class="clear"></div></div><a id="\SoapRequestXmlFixer::__construct()" class="anchor"></a><div class="method public"><a href="#" class="gripper"><img src="../images/icons/arrow_right.png"></img><img src="../images/icons/arrow_down.png" style="display: none;"></img></a><code class="title"><img src="../images/icons/method.png" alt="method" title="method"></img><img src="../images/icons/visibility_public.png" style="margin-right: 5px" alt="public"></img><span class="highlight">__construct</span><span class="nb-faded-text">(boolean $addXsiTypes, boolean $removeEmptyElements, boolean $replaceReferences)</span> : void</code><div class="description"><p class="short_description">Constructor to determine how the XML should be fixed.</p></div><div class="code-tabs"><div class="long-description"></div><strong>Parameters</strong><table class="argument-info"><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tr><th>$addXsiTypes</th><td>boolean</td><td><em><p><var>TRUE</var> if xsi:types should be added
    to all complex type elements</p>
</em></td></tr><tr><th>$removeEmptyElements</th><td>boolean</td><td><em><p><var>TRUE</var> if all empty elements
    should be removed from the XML request</p>
</em></td></tr><tr><th>$replaceReferences</th><td>boolean</td><td><em><p><var>TRUE</var> if element references
    should be replaced with a copy of the element.</p>
</em></td></tr></table></div><div class="clear"></div></div></div></div></div><small class="footer">
            Documentation was generated by
            <a href="http://phpdoc.org">phpDocumentor
                2.0.0a12</a>.
        </small></body></html>
